cmake_minimum_required(VERSION 3.10)
project(rtmp_server)

set(CMAKE_CXX_STANDARD 11)

set(DEBUG -DXOP_DEBUG)

include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/src
    ${CMAKE_CURRENT_SOURCE_DIR}/src/net
    ${CMAKE_CURRENT_SOURCE_DIR}/src/xop
    ${CMAKE_CURRENT_SOURCE_DIR}/src/3rdpart
)

set(SRC1 ${CMAKE_CURRENT_SOURCE_DIR}/src/net/*.cpp)
set(SRC2 ${CMAKE_CURRENT_SOURCE_DIR}/src/xop/*.cpp)
set(SRC3 ${CMAKE_CURRENT_SOURCE_DIR}/example/rtmp_server.cpp)
set(SRC4 ${CMAKE_CURRENT_SOURCE_DIR}/src/3rdpart/mongoose/*.c)

file(GLOB_RECURSE SRC_LIST
    ${SRC1}
    ${SRC2}
    ${SRC3}
    ${SRC4}
)

add_executable(rtmp_server ${SRC_LIST})

# 查找 Qt 库
find_package(Qt5 COMPONENTS Core REQUIRED)
# 包含 Qt 头文件路径
target_include_directories(rtmp_server PRIVATE ${Qt5Core_INCLUDE_DIRS})
target_link_libraries(rtmp_server 
    Qt5::Core
    rt
    pthread
    dl
    m
    ${DEBUG}
)

